import http from './http'
// mock数据
import '@/mock/mock'

// 这里的接口数据都是复用的
// 所有的接口都需要传入路径信息 '/xxx/xxx'
export const getMultiplexListAPI = (path: string, data: any) => {
  if (!path.includes('menu')) {
    return http({
      method: 'GET',
      url: `${path}`,
      params: data
    })
  } else {
    return http.get(path)
  }
}

export const addMultiplexItemAPI = (path: string, data: any) => {
  return http({
    method: 'POST',
    url: `${path}`,
    data
  })
}

export const updateMultiplexItemAPI = (path: string, id: number, data: any) => {
  return http({
    method: 'PATCH',
    url: `${path}/${id}`,
    data
  })
}

export const deleteMultiplexItemAPI = (path: string, id: string) => {
  return http({
    method: 'DELETE',
    url: `${path}/${id}`
  })
}
